diff options
| author | dujinkim <dujin.kim@dtsolution.co.kr> | 2025-06-30 08:28:13 +0000 |
|---|---|---|
| committer | dujinkim <dujin.kim@dtsolution.co.kr> | 2025-06-30 08:28:13 +0000 |
| commit | 5b6313f16f508882a0ea67716b7dbaa1c6967f04 (patch) | |
| tree | 3d1d8dafea2f31274ace3fbda08333e889e06d1c /app/[lng]/engineering/(engineering)/budgetary/[id]/layout.tsx | |
| parent | 3f0fad18483a5c800c79c5e33946d9bb384c10e2 (diff) | |
(대표님) 20250630 16시 - 유저 도메인별 라우터 분리와 보안성검토 대응
Diffstat (limited to 'app/[lng]/engineering/(engineering)/budgetary/[id]/layout.tsx')
| -rw-r--r-- | app/[lng]/engineering/(engineering)/budgetary/[id]/layout.tsx | 90 |
1 files changed, 90 insertions, 0 deletions
diff --git a/app/[lng]/engineering/(engineering)/budgetary/[id]/layout.tsx b/app/[lng]/engineering/(engineering)/budgetary/[id]/layout.tsx new file mode 100644 index 00000000..b0711c66 --- /dev/null +++ b/app/[lng]/engineering/(engineering)/budgetary/[id]/layout.tsx @@ -0,0 +1,90 @@ +import { Metadata } from "next" +import Link from "next/link" +import { ArrowLeft } from "lucide-react" +import { Separator } from "@/components/ui/separator" +import { SidebarNav } from "@/components/layout/sidebar-nav" +import { RfqViewWithItems } from "@/db/schema/rfq" +import { findRfqById } from "@/lib/rfqs/service" +import { formatDate } from "@/lib/utils" +import { Button } from "@/components/ui/button" + +export const metadata: Metadata = { + title: "Vendor Detail", +} + +export default async function RfqLayout({ + children, + params, +}: { + children: React.ReactNode + params: { lng: string, id: string } +}) { + + // 1) URL 파라미터에서 id 추출, Number로 변환 + const resolvedParams = await params + const lng = resolvedParams.lng + const id = resolvedParams.id + + const idAsNumber = Number(id) + // 2) DB에서 해당 협력업체 정보 조회 + const rfq: RfqViewWithItems | null = await findRfqById(idAsNumber) + + // 3) 사이드바 메뉴 + const sidebarNavItems = [ + { + title: "Matched Vendors", + href: `/${lng}/evcp/budgetary/${id}`, + }, + { + title: "TBE", + href: `/${lng}/evcp/budgetary/${id}/tbe`, + }, + { + title: "CBE", + href: `/${lng}/evcp/budgetary/${id}/cbe`, + }, + ] + + return ( + <> + <div className="container py-6"> + <section className="overflow-hidden rounded-[0.5rem] border bg-background shadow"> + <div className="hidden space-y-6 p-10 pb-16 md:block"> + {/* RFQ 목록으로 돌아가는 링크 추가 */} + <div className="flex items-center justify-end mb-4"> + <Link href={`/${lng}/evcp/budgetary`} passHref> + <Button variant="ghost" className="flex items-center text-primary hover:text-primary/80 transition-colors p-0 h-auto"> + <ArrowLeft className="mr-1 h-4 w-4" /> + <span>Budgetary Quote 목록으로 돌아가기</span> + </Button> + </Link> + </div> + + <div className="space-y-0.5"> + {/* 4) 협력업체 정보가 있으면 코드 + 이름 + "상세 정보" 표기 */} + <h2 className="text-2xl font-bold tracking-tight"> + {rfq + ? `${rfq.projectCode ?? ""} ${rfq.rfqCode ?? ""} 관리` + : "Loading RFQ..."} + </h2> + + <p className="text-muted-foreground"> + {rfq + ? `${rfq.description ?? ""} ${rfq.lines.map(line => line.itemCode).join(", ")}` + : ""} + </p> + <h3>Due Date:{rfq && rfq?.dueDate && <strong>{formatDate(rfq?.dueDate)}</strong>}</h3> + </div> + <Separator className="my-6" /> + <div className="flex flex-col space-y-8 lg:flex-row lg:space-x-12 lg:space-y-0"> + <aside className="lg:w-64 flex-shrink-0"> + <SidebarNav items={sidebarNavItems} /> + </aside> + <div className="lg:w-[calc(100%-16rem)] overflow-auto">{children}</div> + </div> + </div> + </section> + </div> + </> + ) +}
\ No newline at end of file |
